Skip to content

feat: 1.3.0 gate bundle — TypeScript generators on the code writer, changelog fragments, agent-docs - #646

Merged
dmealing merged 46 commits into
mainfrom
fm/mo-130-gate-bundle-2
Nov 25, 2026
Merged

dmealing merged 46 commits into
mainfrom
fm/mo-130-gate-bundle-2

Conversation

@dmealing

@dmealing dmealing commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • Codegen (TypeScript lane): every TypeScript generator — entity tiers, queries/routes/report-export/callable/barrel, the prompt tier, the React form, TanStack and Angular, and the SQL-view/Cube/Prisma emitters — now emits through the code writer (ADR-0063); the dprint formatter is dropped and the @metaobjectsdev/test-generators package is retired (the layout check covers its kind). A generator declares what it provides through one provides declaration read via providesOf, replacing the nine single-purpose marker flags, and the generator-authoring surface is pinned per port in fixtures/generator-registry-conformance (ADR-0034 Amendment 12, ADR-0035 Amendment 7, ADR-0065 Amendment 5; @metaobjectsdev/codegen-ts/engine also exports objectRefTarget). Behavior fixes: an entity named after a reserved word (Case, Class) now gets a queries module that parses, the generated Angular form binds its controls (formControlName="email", Validators imported only when used), and the generated agent pages sort in code-unit order so every port can match them.
  • CLI, docs and explorer: meta init --with-services wires the recommended service generator list and meta verify advises (exit code unchanged) when a source-backed entity declares a lifecycle no listed service generator enforces (ADR-0067 §6, §8). meta migrate appears in the port docs and agent files only as the reference migration helper, and its steps ship only to a project that set migrate.dialect (hasMigrate; the shipped agent tree moves to manifest schema 2 with -migrate variants). The docs site gains a generic explorer page for every top-level node and builds on models with their own top-level vocabulary (no more two nodes share the id throw); fixtures/docs-page-conformance now pins the rows the pages and site share, exported as schemaRows() / schemaInputFromRows(). Generated-output change throughout — regenerate to pick it up; three-way merge preserves hand edits.
  • Python, agent skills, release and CI: metaobjects agent-docs writes the shipped agent files itself with no Node (npx meta agent-docs byte parity, .new parking beside hand-edited files, drift-gated copy) and metaobjects gen gains ejectable requirements and agent-docs generators rendering the shared Mustache templates (whose engine now treats a string-valued section as context). The seven agent skills are rewritten Essentials-first, evaluated by a blind A/B harness under agent-context/evals/skill-ab/, and @metaobjectsdev/sdk no longer ships that harness. Changelog entries become per-change changelog.d/ fragments assembled by release.mjs, which refuses to open a second heading when a release section was prepared ahead of the cut. scripts/ci-local.sh admits a lane only when MemAvailable covers MO_CI_LANE_MIN_FREE_MB, and the SQLite/D1 report api-contract suite drops from ~10 minutes to ~46 seconds; the install-size budget lowers to 46.6 MB after dprint.
Validation

Risk Assessment

✅ Low: The only change since the prior review moves the in-memory CHANGELOG assembly and the split refusal ahead of the version bump in scripts/release.mjs; the fix is correct and introduces no new defect.

Testing

Baseline scripts/ci-local.sh --affected --strict-toolchains already passed at the target commit and was not re-run (no source changes made this turn). On top of it I drove three live scenario clusters against the real product in disposable fixtures under $DEV_SCRATCH (all torn down; worktree left clean): (1) the split-CHANGELOG refusal now fires before the version bump — a real release.mjs 1.3.0-rc.1 run died in Phase 0 with exit 1 and byte-identical package.json/CHANGELOG/fragments before and after, and the folded layout proceeded past the changelog stage to the real npm free-check; (2) the changelog-fragments CLI check/preview/assemble behaved per its documented contract (sorted placement under [Unreleased], README excluded, malformed refused); (3) meta init --with-services wired the five ADR-0067 service generators, meta gen emitted the service tier from a lifecycle entity (including the derived transition command), and the D1 dialect wired the service without interactive transactions. No failures; no UI surface was involved, so no screenshot evidence applies — transcripts are in the artifacts.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Release with a split CHANGELOG ([Unreleased] entries above a prepared [VERSION] section) refuses in Phase 0 and writes nothing — driven by the real release.mjs on a scratch git repo with the real spli… ✅ pass live local log split-refusal-release-run.log — exit 1 with the fix's refusal message; sha256 of every package.json + CHANGELOG.md + changelog.d/* identical…
After the author folds the fragments (changelog-fragments.mjs --assemble, then hand-move into the prepared section) the release passes the moved changelog stage and reaches the later preflight gates —… ✅ pass live local log release-happy-preflight.log — zero split messages, died at "1.2.0-rc.1 is already published for: …", tree clean; assemble/preview/check tran…
A new project wires the ADR-0067 service tier with meta init --with-services and generates it from a lifecycle entity — sqlite wires the five recommended generators and meta gen emits the service file… ✅ pass live local log init-with-services-sqlite.log and init-with-services-d1-config.log — built dist/bin/meta.js v1.3.0, init exit 0, config wiring lines, emitte…
Evidence: Split CHANGELOG refusal before version bump (release.mjs 1.3.0-rc.1, no-write proof)

✗ CHANGELOG has entries under [Unreleased] (3 from changelog.d/) above a prepared [1.3.0-rc.1] section. Fold them into that section by hand (node scripts/changelog-fragments.mjs --assemble, then move them), and re-run. | exit=1, NO-WRITE-CONFIRMED

# Scenario 1: split CHANGELOG refusal fires BEFORE the version bump (release.mjs, commit 993a909e0e)
# Fixture: scratch git repo (branch main, bare local origin), real scripts/, real workspace package.jsons,
# CHANGELOG.md = real repo layout with [Unreleased] non-empty above prepared '[1.3.0-rc.1] — unreleased',
# 3 real changelog.d/ fragments. npm whoami stubbed (read-only boundary); npm registry free-check hit for real.
# Run WITHOUT --preflight-only: the refusal must fire in Phase 0, before Phase 1 writes package.json.
# sha256 of every package.json + CHANGELOG.md + fragments recorded before and after: identical => NO-WRITE-CONFIRMED.

exit=1

── Releasing 1.3.0-rc.1 ──

✓ npm auth: gate-smoke-user
✗ CHANGELOG has entries under [Unreleased] (3 from changelog.d/) above a prepared [1.3.0-rc.1] section. Fold them into that section by hand (node scripts/changelog-fragments.mjs --assemble, then move them), and re-run.
NO-WRITE-CONFIRMED  (sha256 before/after diff: empty)
Evidence: Folded layout passes the moved changelog stage (release --preflight-only stops at npm free-check)

✗ 1.2.0-rc.1 is already published for: @metaobjectsdev/metadata … — zero split messages; post-run git status clean

# Scenario 2: after the author folds fragments (changelog-fragments.mjs --assemble + hand-move into the
# prepared section), release --preflight-only passes the moved changelog stage and proceeds into the later
# preflight gates. Version 1.2.0-rc.1 chosen so the run stops deterministically at the real npm free-check
# (that version is taken on registry.npmjs.org) instead of the multi-port showcase regen. Zero split messages.


── Releasing 1.2.0-rc.1 ──

✓ npm auth: gate-smoke-user
✗ 1.2.0-rc.1 is already published for:
  @metaobjectsdev/metadata
  @metaobjectsdev/render
  @metaobjectsdev/docs-site
  @metaobjectsdev/migrate-ts
  @metaobjectsdev/codegen-ts
  @metaobjectsdev/runtime-ts
  @metaobjectsdev/sdk
  @metaobjectsdev/runtime-web
  @metaobjectsdev/codegen-ts-react
  @metaobjectsdev/codegen-ts-tanstack
  @metaobjectsdev/react
  @metaobjectsdev/tanstack
  @metaobjectsdev/cli
npm versions are permanent — pick the next free version.
post-run git status: clean (preflight wrote nothing)
Evidence: changelog-fragments.mjs check/preview/assemble on real fragments

assembled 3 fragment(s) into CHANGELOG.md [Unreleased] and removed them; first bullets in sorted-name order: cli init --with-services, codegen-ts generator provides, Python agent-docs

# Scenario 3a: scripts/changelog-fragments.mjs on 3 real fragments (fixture repo)

== malformed fragment refused ==
changelog.d/ has malformed fragments (format: changelog.d/README.md):
  BAD-NAME.md: name must be lower-case letters, digits, '.', '_' or '-', ending in .md
exit=1

== --preview: fragments land at top of [Unreleased], README excluded ==
## [Unreleased]

- **cli: `meta init --with-services` and the `unenforced-lifecycle` advisory (ADR-0067 §6, §8).**
  `init` still writes an empty generator list; `--with-services` writes the recommended service list
  instead (`entityFile()`, `rulesNamesFile()`, `contractTypes()`, `serviceFile()`,
  `serviceRoutesFile()`, with `serviceFile({ interactiveTransactions: false })` on `--d1`) and names
  the packages their output needs. `meta gen --list` names the same list under the catalog.
  `meta verify` now advises, without changing the exit code, when a concrete entity with a source
  declares a lifecycle and no listed service generator covers it: the flat routes do not enforce
  it.

- **codegen-ts: a generator declares what it provides in one place.** `provides` on a `Generator`

== --assemble ==
assembled 3 fragment(s) into CHANGELOG.md [Unreleased] and removed them
exit=0; changelog.d/ now holds only README.md

== first three top-level bullets under [Unreleased] (sorted-name order: the documented contract) ==
Evidence: meta init --with-services (sqlite) + meta gen service tier

generators: [entityFile(), rulesNamesFile(), contractTypes(), serviceFile(), serviceRoutesFile()]; submitThing.ts: const move: TransitionSpec = { name: "submit", field: "status", from: ["draft"], to: "submitted" }

# Scenario 4: meta init --with-services on the built CLI (dist/bin/meta.js, version 1.3.0)
# sqlite scaffold wires the recommended ADR-0067 service list; a lifecycle entity then generates the service tier.

== init message ==
meta: --with-services: wired entity, rules-names, contract-types, service, service-routes. Their output needs: npm i -D @metaobjectsdev/codegen-ts@^1.3.0 && npm i @metaobjectsdev/runtime-ts@^1.3.0 'drizzle-orm@>=0.36.0 <1.0.0' 'fastify@>=5.0.0 <6.0.0' 'zod@>=3.23.0 <5.0.0'

== metaobjects.config.ts (sqlite) ==
import { defineConfig } from "@metaobjectsdev/cli";
import { entityFile, rulesNamesFile, contractTypes, serviceFile, serviceRoutesFile } from "@metaobjectsdev/codegen-ts/generators";
  generators: [entityFile(), rulesNamesFile(), contractTypes(), serviceFile(), serviceRoutesFile()],

== meta gen on Thing (enum lifecycle status: submit draft->submitted) emits the service tier ==
src/generated/acme/things/{Thing.ts,Thing.contract.ts,rules.names.ts,service/{create,get,list,update,delete,submit}Thing.ts,transport/fastify.ts}, errors.contract.ts

== derived transition command (submitThing.ts, ADR-0066 §2/§6) ==
/** `status`: draft → submitted. */
const move: TransitionSpec = { name: "submit", field: "status", from: ["draft"], to: "submitted" };
export async function submitThing<A>(deps: ServiceDeps<A>, id: number | string, opts: OpOptions<A> = {}): Promise<OpResult<Thing>> {
  return inWriteTransaction(deps.db, opts.tx, async (tx) => {
    const cond = keyCondition(things, "id", id);
    const current = (await loadForWrite(tx, things, cond, "sqlite")) as Thing | undefined;
    if (current === undefined) notFound();
    await checkPermission(deps.policy, "acme::things.Thing.submit", opts.actor, current, undefined, tx);
Evidence: meta init --with-services --dialect d1 (service without interactive transactions)

generators: [entityFile(), rulesNamesFile(), contractTypes(), serviceFile({ interactiveTransactions: false }), serviceRoutesFile()]

# Scenario 4b: --dialect d1 — D1 holds no interactive transactions, so the service generator is wired without one

  generators: [entityFile(), rulesNamesFile(), contractTypes(), serviceFile({ interactiveTransactions: false }), serviceRoutesFile()],

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ scripts/release.mjs:262 - The 'split' CHANGELOG refusal fires too late in the release. promoteChangelog runs after the version bump (package.json writes, scripts/release.mjs:220) and rm -f bun.lock &amp;&amp; bun install (:228) plus the pack check. When it returns 'split' the script die()s with every package.json bumped and bun.lock regenerated. A re-run then fails at the dirty-tree check (:101), which tolerates only CHANGELOG.md and changelog.d/, until the author reverts by hand. The repo is already in the split layout: a prepared [1.3.0] section plus 14 fragments, so the 1.3.0 cut will hit this path. Fix: compute assembleChangelog and promoteChangelog next to the fragment-validation block (~:106) and die there, before any file is written. The later step then only writes the result.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Release with a split CHANGELOG ([Unreleased] entries above a prepared [VERSION] section) refuses in Phase 0 and writes nothing — driven by the real release.mjs on a scratch git repo with the real spli… ✅ pass live local log split-refusal-release-run.log — exit 1 with the fix's refusal message; sha256 of every package.json + CHANGELOG.md + changelog.d/* identical…
After the author folds the fragments (changelog-fragments.mjs --assemble, then hand-move into the prepared section) the release passes the moved changelog stage and reaches the later preflight gates —… ✅ pass live local log release-happy-preflight.log — zero split messages, died at "1.2.0-rc.1 is already published for: …", tree clean; assemble/preview/check tran…
A new project wires the ADR-0067 service tier with meta init --with-services and generates it from a lifecycle entity — sqlite wires the five recommended generators and meta gen emits the service file… ✅ pass live local log init-with-services-sqlite.log and init-with-services-d1-config.log — built dist/bin/meta.js v1.3.0, init exit 0, config wiring lines, emitte…
  • scripts/ci-local.sh --affected --strict-toolchains
  • baseline broad regression: scripts/ci-local.sh --affected --strict-toolchains (already ran and passed at target commit 993a909e0e; not re-run, no source changes this turn)
  • Scenario 1: bun scripts/release.mjs 1.3.0-rc.1 against a scratch git repo carrying the real split CHANGELOG layout ([Unreleased] non-empty above a prepared [1.3.0-rc.1] section, 3 real changelog.d/ fragments), real scripts/ and real workspace package.jsons, npm whoami stubbed read-only, npm registry free-check reached for real; refusal fired in Phase 0 with the fix's message, exit 1, sha256 before/after of every package.json + CHANGELOG.md + fragments identical (NO-WRITE-CONFIRMED)
  • Scenario 2: node scripts/changelog-fragments.mjs --check/--preview/--assemble on the 3 real fragments (malformed BAD-NAME.md refused exit 1; assemble placed fragments sorted by name at the top of [Unreleased], README excluded, fragments deleted), then the hand-fold into the prepared section and bun scripts/release.mjs 1.2.0-rc.1 --preflight-only: zero split messages, run proceeded past the moved changelog stage and stopped deterministically at the real npm free-check (version taken), tree clean
  • Scenario 3: bun <worktree>/server/typescript/packages/cli/dist/bin/meta.js init --with-services (v1.3.0) in scratch dirs: sqlite scaffold wired entityFile, rulesNamesFile, contractTypes, serviceFile, serviceRoutesFile from @metaobjectsdev/codegen-ts/generators and printed the install needs; meta gen on a Thing entity with a field.enum lifecycle emitted the service tier incl. the derived submitThing transition command and transport/fastify.ts; --dialect d1 wrote serviceFile({ interactiveTransactions: false })
🔧 **Document** - 1 issue found → auto-fixed (2) ✅
  • ℹ️ docs/features/metadata-sources.md:80 - Pre-existing, not made stale by this change: the 'neutral subset' paragraph still says the non-TypeScript ports read only schema_version and sources and ignore every other top-level key, while the same page's FR-023 block (line 55) and the libraries/scope docs say those neutral keys are read at every rung, and Python's NeutralConfig reads dependencies, scope.include, migrate.scope and libraries too. I narrowed only the part this change invalidated (Python's new migrate.dialect read); fully reconciling the paragraph into one accurate statement of which neutral keys each port reads is a follow-up that needs enumerating each port's reader.

🔧 Fix applied.
1 info still open:

  • ℹ️ docs/features/libraries.md:13 - Judgment call: the libraries doc presents &#34;libraries&#34;: [&#34;iam&#34;] in .metaobjects/config.json as the opt-in with no per-port caveat, but Java/Kotlin read libraries only from the Maven &lt;loader&gt;&lt;libraries&gt; element (NeutralConfig.java never reads the key; AbstractMetaDataMojo gets it from loaderConfig). TypeScript, Python, C# and Rust read the neutral key. This is the FR-043 §12 Q4 lag the C# header records ('the JVM/C# ports can follow' — C# followed, JVM has not), not something this change made stale. I documented the split honestly in the neutral-subset bullet in metadata-sources.md; whether to add a one-line caveat to libraries.md (or teach Java's loader to read the neutral key) is a product decision.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

… report corpus boots once per suite

The gate's test step on PR 645 kept failing in ways that passed when re-run in the foreground.
Two causes, both fixed here.

1. The C# 'Test host process crashed' and the SIGTERMed bun workers and rustc were earlyoom.
   The system journal shows it SIGTERMing the dotnet test host (2.6-3.4 GiB), bun workers and
   rustc while MemAvailable sat below 4%. scripts/ci-local.sh now holds a waiting lane until
   MemAvailable covers MO_CI_LANE_MIN_FREE_MB (default 8192) for it and for each lane started
   in the last 30 seconds. The first lane always starts, and 0 turns the check off.
   scripts/test-ci-lane-memory.sh (in the gates lane) pins the rule.

2. api-contract-report-sqlite.test.ts ran codegen and booted a server, Miniflare included on D1,
   for each of its 378 tests, and re-seeded D1 one statement per round trip. It took about
   604s, so an agent with a 10-minute command cap was killed before it reported. It now
   generates and boots once per lane, layout and engine, and reseeds in one batch
   (D1 batch(), a bun:sqlite transaction). Runtime is about 46s, 378 pass.
Top-level nodes of different types sharing a package and a name made
buildExplorer throw a duplicate-id error. The object now keeps the plain
<package>::<name> id and each other node is qualified by its type, as a
nested sibling already was; a model with no collision keeps its ids. A
requirement whose id took a qualifier still matches its ledger row.

The site wrote pages only for objects and templates, so a requirement
claiming a node of another type failed the link check. Every other
top-level type now gets a generic page (explorer-node.html.mustache),
listed on its package page and in search.
…g.d/

Every PR added its entry at the top of CHANGELOG.md's [Unreleased], so
any two PRs in flight edited the same lines and conflicted as each other
landed. A PR now adds one file under changelog.d/ instead; release.mjs
folds the fragments into [Unreleased] (file-name order) and deletes them
before promoting, so a release still ships one CHANGELOG.md.

- scripts/lib/changelog-fragments.mjs: read, validate and assemble
- scripts/changelog-fragments.mjs: --check | --preview | --assemble
- gates lane: 'changelog fragments' step (shape check + assembly tests)
- lane map: changelog.d/* selects no test lane, like CHANGELOG.md
- RELEASING, CONTRIBUTING, PR template and the releasing skill point at
  changelog.d/README.md, which carries the entry conventions
…forces (ADR-0067 §6)

A concrete entity with a source and a lifecycle, in a project whose generators list no
service generator covering it (by stable name, or a serviceFile() whose filter keeps it),
is named in verify's advisory tier as rule "unenforced-lifecycle". Never an exit code.
Part of L-TS-7; the init flag, docs and gen --list follow.
…st (ADR-0067 §8)

init still writes an empty generator list. --with-services writes entityFile(), rulesNamesFile(),
contractTypes(), serviceFile() and serviceRoutesFile() instead (serviceFile({ interactiveTransactions:
false }) on D1), read from the generator registry, and prints the install set their output needs.
On an existing config it leaves the file alone and says what to add. meta gen --list names the same
list once under the catalog. ADR-0066/0067, business-rules.md, cli.md and the CHANGELOG now describe
the shipped unenforced-lifecycle advisory instead of "once that check lands". Completes L-TS-7.
…ite share (D0a)

The 1.3.0 docs-page design pass, done against the docs design: the pages G0 pinned are
built from rows the docs site reuses, so no fact is pinned twice in two shapes.

- fixtures/docs-page-conformance pins expected/rows/ under each case's page data:
  rows/requirements.json (the RequirementRow ledger rows both requirements pages are built
  from) and rows/schema.json (the model-only schema rows: tables, columns, foreign keys,
  views and declaredBy, every dialect fact left out).
- codegen-ts exports schemaRows() (the expected schema projected onto those rows) and
  schemaInputFromRows() (the page builder's input rebuilt from rows alone). The runner
  rebuilds the model-only page data from rows/schema.json, so it provably needs nothing a
  port without the expected schema lacks.
- cli/test/docs-page-shapes.test.ts holds the requirement rows equal to what the explorer
  graph holds (requirement node attributes plus the verify ledger row) and the schema rows
  to a subset of meta schema --as json, the storage lens's input.
- README, codegen-data-shapes.md, CONFORMANCE.md and the CHANGELOG say so. No page changes
  a byte.
…red templates (G-PY-1)

Python gains the requirements generator (requirements.md, requirements.toon) and the
agent-docs generator (agent/requirements.md and the model-only agent/schema.md; agent/ui.md
stays TypeScript-only). Both render the shared Mustache templates from the data model pinned by
fixtures/docs-page-conformance/, held by a pytest runner that checks rows, page data, then bytes.

- Templates are bundled in the package (render/bundled_templates), synced by
  scripts/sync-doc-templates.sh and held by the doc-template drift gate; a same-named template
  under the project's templates directory overrides a page.
- Registered as neutral/docs/ejectable; registry.json ports now list python.
- The Python Mustache engine treats a truthy scalar section as the context so {{.}} names it.
…tself (G-PY-2)

The command no longer prints a redirect to the Node CLI. It copies one stack of the
shipped agent files (.metaobjects/AGENTS.md and the metaobjects-* skills) out of a committed
copy of agent-context-shipped/ inside the wheel, pins guide links to the release tag (a
prerelease keeps main), and matches the TypeScript scaffolder's re-run rules: unchanged files
and manifest are not rewritten, hand-edited files get <file>.new, untouched orphans are pruned.
Flags: --server, --client (default python), --out, --no-wire-root.

The wheel carries the copy (no build hook; hatch_build.py removed). The gates lane and
tests/unit/test_agent_docs.py fail when it drifts; scripts/sync-python-agent-context.sh
refreshes it.
…he Node redirect (G-PY-2)

The Python codegen and audit references and the Python staleness nudge still told a Python user
to run npx meta agent-docs, which G-PY-2 made unnecessary. The shipped tree, its Python package
copy and the python agent-context-conformance golden are rebuilt from the edited source.
The entity module's tier-A templates now lay out their own output through
TsWriter (ADR-0063) instead of ts-poet `code` templates and dprint: the
Drizzle schema and columns, relations, constants, shared enums, the
enum-int and duration codecs, value objects, filter allowlists and filter
type, inferred types, names, TPH union, view and projection declarations,
and the entity and value-object composers.

- The entity composer is a class, `EntityFileWriter`, with one overridable
  method per section (spec/code-writer.md, "Extension by subclassing").
  `entityFile({ writer })` takes a subclass, in the built-in generator and
  in the reference copy.
- Each converted template keeps its `render*` export, which returns
  `TsWriter.toCode()`, so owned 1.2 copies and unconverted callers still
  compose. New `write*` functions write into a caller's writer.
- `TsWriter.toCode()` / `useImport()` bridge writer output and poet `Code`.
  `TsWriter.code(fragment, { format: true })` lays out a tier-B fragment
  (Zod validators) with the dprint pass until W-TS-3 converts it.
- Fixed helper text that relied on dprint for braces and spacing is
  written braced and spaced in the source, so the output does not change.
- The layout-ratchet allowlist drops the 18 converted files.

Output: token-identical across 6,937 generated files (3 dialects x every
fixture model; entity, names and contract-types tiers), with one exception:
a cross-field refinement keeps redundant parentheses dprint used to strip.
Layout changes, as goldens show: imports are hoisted into one header
(allowlist type imports used to appear mid-file), a blank line separates
sections, and one-line objects that do not fit the width break per member.
Goldens, owned template copies and the showcase are regenerated.
… and cut what the model no longer needs

Each SKILL.md under agent-context/skills/ now opens with an Essentials block (the rules
that have to survive compaction), gives the reason for each rule that stays, and drops the
step-by-step procedures and capitalised emphasis current models do not need. Every
description leads with the use case and is under 1,536 characters, every file is under 500
lines, and none asks for reasoning in the reply.

Checked with a blind A/B: 23 fixed tasks, the skills before against the skills after, two
rounds on Claude Sonnet 5.5, scored against a rubric written first. Before scored 134 and
136 of 137, after scored 136 and 137. The rewrite was never behind on a task, so no cut was
put back. The harness is agent-context/evals/skill-ab/ and the record is
docs/superpowers/specs/2026-11-22-agent-skills-fable5-refactor-evaluation.md.

Also:
- bundle.test.ts fails when the SDK's bundled agent-context/ is not byte-identical to the
  source. The bundle is gitignored and had drifted (its audit skill was 570 lines against
  331), and init, the shipped tree and the conformance regeneration read it first.
- Two reference files said apiPrefix reaches the client fetch URLs. It does not: the client
  takes its prefix from baseUrl on the fetcher provider.
- The SDK bundle leaves out agent-context/evals/, so the npm package no longer ships the
  skills' test harness.
- fixtures/agent-context-conformance/ and agent-context-shipped/ are regenerated.
- check-positioning-claims.ts drops an allowance for a heading that no longer exists.
The Zod validators, the decimal and timestamp write helpers and the
DB-free entity descriptor module now lay out their own output through
TsWriter (ADR-0063) instead of ts-poet `code` templates and the dprint
pass.

- zod-validators.ts: `writeZodValidators`, `writeInsertSchemaOnly` and
  `writeTphSubtypeReadSchema` write into a caller's writer; the `render*`
  exports keep returning `TsWriter.toCode()` for owned 1.2 copies and the
  contract-types composer. Cross-field refinement rules are writer
  callbacks instead of strings with typed line breaks and indentation.
- `TsWriter.reopen()` closes the open block and opens the next on one line
  (`}).superRefine((row, ctx) => {`), documented in spec/code-writer.md's
  TypeScript dialect section.
- The decimal and UTC-timestamp helpers are `writeDecimalWriteHelper` /
  `writeUtcTimestampHelper` text snippets, like the duration helper; their
  `*_DECL` text is unchanged byte for byte.
- entity-meta-file.ts writes its banner with `header()` and the descriptor
  with `writeEntityConstants`, so it matches the entity file's copy.
- The transitional `TsWriter.code(fragment, { format: true })` option and
  `formatFragment` are removed: nothing calls them now.
- The layout-ratchet allowlist drops the four converted files.

Output: token-identical across 6,937 generated entity-tier files and 961
descriptor modules, with the one known exception (redundant parentheses
in a cross-field refinement that dprint stripped). Layout changes: Zod
field chains stay on one line, multi-line doc comments take the writer's
block form, and descriptor members break one per line as in the entity
file. Goldens, owned template copies, the showcase and advanced-modeling
output and the site payload are regenerated.

Also brings two W-TS-2 leftovers current: the ejected-generator verify
test now edits the generator's content line (the header moved into the
writer), and the deep-currency site excerpt is re-cut from the
regenerated advanced-modeling output.
The prompt-tier generators now lay out their output through TsWriter
(ADR-0063): the prompt render handles (and their reference copy), the
output parser and its extract-delegate mirrors and mappers, the
extractor, the response-format fragment, the render helper, and the
trace helper with its llm-call support module.

- Every import goes through the writer, so each module's imports are
  collected, merged per module and printed in the writer's order.
- The strict Zod schema is a small tree the writer prints, so a nested
  object schema still opens and closes on its own lines without a
  hand-built indent.
- Fixed function bodies with interpolated names are `text()` snippets;
  mirrors, mappers and the delegate helpers are `write*` walks.
- `jsonStringLiteral` escapes through one regex keyed by char code
  instead of `case "\n"` labels (same output).
- TsWriter `use`/`useType` take an optional local alias
  (`import { X as Y }`), as the Python dialect's `use` does; spec and
  writer tests cover it. `useValueObjectType` records a value object's
  import on a writer.
- The layout-ratchet allowlist drops the nine converted files.

Output: token-identical across 302 prompt-tier files from every fixture
model, with and without the `ai` library. Byte changes are import order
and merging (two `@metaobjectsdev/render` lines become one), a blank
line after the banner, one blank line where there were two, and a final
newline on the trace helper. The two TypeScript-only conformance
goldens (template-prompt-simple prompts.ts, template-prompt-response-json
response.ts), the showcase and advanced-modeling output and their hashes
are regenerated; tests that matched the old import text now match the
new.
… barrel on the code writer

The queries, routes (Fastify and Hono), routes index, report export, callable and barrel
templates lay their output out with the code writer (ADR-0063); 15 files leave the layout
ratchet's allowlist.

The reference generators no longer carry a second copy of the composition: routes,
routes-hono, report-export, barrel and queries call the template module that `meta eject`
copies beside them, so an owned copy still owns every line it emits and about a thousand
duplicated lines are gone.

The 1.2 engine primitives an owned copy calls (the render<Verb>Fn functions, dbTypeBlock,
schemaInputType, the *Line mount helpers, exposeLine, authSeamJsDoc) stay as deprecated
wrappers over the new write* functions, so an ejected 1.2 queries or routes copy still loads.

Fixes an entity named after a reserved word (`Case`): its queries module wrote
`const [case] = ...`, which does not parse; the row variable now takes the Row suffix.
The form template lays its .tsx out with the code writer (ADR-0063) and leaves the layout
ratchet's allowlist. Each JSX element is written as one line, laid out as the template reads;
the image upload's meta object is a breakable list.

Imports are recorded where a name is used, so the hand-built conditional import strings for
useFieldArray, Controller and ImageUpload are gone, and each module prints on one line. The
nested value-object recursion returns its markup as a deferred write beside the useFieldArray
hooks it needs, so the hooks still print at the top of the component.

writeFormFile(w, entity, ctx) is the new export; renderFormFile keeps its (entity, ctx) =>
string signature. Over every fixture plus one covering each control kind, the output keeps the
1.2 form's tokens, except that an image field with an empty meta keeps the parentheses around
its one-line render arrow.
…ular on the code writer

The TanStack hooks, grid columns and grid hook, and the Angular service,
form, grid and barrel, now write through TsWriter (ADR-0063). Each template
gains a write* export beside its render*. The query and mutation hooks
share one writer each, and the TPH and plain paths share the CRUD trio.
A new json() helper writes the grid filter preset; api-surface's
jsonLiteral now uses it.

The token oracle matches every TanStack file over 842 generated fixtures.
The Angular form changes on purpose: [formControlName]=""x"" (no binding)
becomes formControlName="x", and Validators is imported where it is used
instead of through the __ensureValidatorsImport__ anchor.

client-directive.ts stays on the ratchet list with a new reason. It is the
after-render seam that the reference generators and owned copies call, so
the close-out decides it.

Also regenerates the codegen-ts React form goldens that W-TS-6 left stale.
…de writer

The projection and report view DDL, the Cube data-model YAML and the
Prisma schema and CHECK SQL now write through the code writer (ADR-0063).
Their output is byte-identical: the cube-model corpus, the prisma goldens,
the canonical schema artifact and the migrate-ts suite pass unchanged.

CodeWriter gains indented(body), a block delimited by indentation alone
(the TypeScript counterpart of C#'s Hanging() and Python's suites), used
by the SQL clause lists. A YamlWriter dialect (key, item) carries the
Cube YAML. Both are documented in spec/code-writer.md and exported. The
four files leave the layout ratchet's unconverted list.
…r; drop dprint

Code.toString() returns the printed text as composed instead of running dprint
(WebAssembly) over it. No shipped generator reaches it: every one writes through the
code writer. code/imp/joinCode/Code/Import stay exported so an owned 1.2 generator copy
still loads (plan risk 6). codegen-ts drops @dprint/formatter and @dprint/typescript.
…ut check covers its kind

The private test-generators package held owned copies of the reference entity,
queries, routes, barrel and report-export generators for the suites to drive.
Those generators now ship from @metaobjectsdev/codegen-ts/generators on the code
writer, byte-identical to what meta eject writes, so the 34 importers (cli,
react, tanstack and integration-tests suites) import the packaged ones. The
owned-copy path stays gated by the examples' copies (owned-copies-current, the
sync script and the reference-template lint).

The layout ratchet gains a check that no package outside its scanned set
carries a reference generator, which is how test-generators sat outside it.
client-directive.ts stays on the ratchet list, ruled: prepending the directive
must keep a body's blank lines byte for byte, which the writer would collapse.
The vendored printer stays as the writer's import emitter and as the legacy
code/imp/joinCode exports that owned 1.2 copies load.
…rint

Dropping @dprint/formatter and @dprint/typescript from codegen-ts (W-TS-9)
takes 5.0 MB off what npm install @metaobjectsdev/cli puts on disk, and the
budget check fails a saving it is not told about, so the budget moves down to
the measurement (linux-x64).
…tion (T1)

Each port page now leads with its native migration path (EF Core Migrations,
Flyway/Liquibase, Exposed, Alembic, sqlx) fed by `meta schema`, and names the
Node `meta migrate` as the reference helper. `meta init` prints its migrate
step only when a dialect was chosen. The always-on page's Schema section is
reworded to match, and its page-size line reflects TypeScript's default of 50.
Agent-context shipped tree and conformance goldens regenerated.
…at chose a migrate dialect (T1)

The always-on .metaobjects/AGENTS.md carries the reference migration helper's
section, the `verify --db` step and the migrations commit line only when the
project set `migrate.dialect` (written by `meta init --dialect`/`--d1`; MySQL
writes none). The choice is a `migration` flag on the resolved Stack, read from
the config at init and refresh. The shipped agent tree ships every stack with
and without the steps (`-migrate` id suffix, manifest schema 2).

The generated agent/schema.md says to change the schema with `meta migrate`
on the same condition, and otherwise with the project's own tool from the
schema `meta schema` prints: `hasMigrate` in the shared page data, pinned by
the docs-page corpus (schema-model sets it through its input config).

Also rewords the four agent-context skill passages that still said one
shared TypeScript engine owns every port's schema.
ADR-0034 Amendment 12, ADR-0035 Amendment 7 and ADR-0065 Amendment 5 name each
port's generator-authoring surface (the generator interface, the model walk,
the writer, the naming helpers), version it with the port's codegen package
under the compatibility policy, and make the rest of the engine internal.
Reference templates that eject copies are owned code, never surface. A
generator declares what it provides in one place, not in flags named after
packaged generators. The shared generator list gains a surface block naming
each port's modules by role; the compatibility policy and the Rust port page
say the same.
AUTHORING_SURFACE names the TypeScript surface in its four roles and is held to
the shared manifest's surface.typescript. model-walk.ts joins the engine (and
its entry), so every surface module is reachable through it. A name-level
snapshot pins what the engine entry exports from the surface modules. The
reference copies' deep templates/* imports stay out of the surface: eject
copies those modules into the project as owned code.
…ker flags (T7-TS 2)

A generator now states what it provides in one place, provides on the
Generator: entityModule, queries, names, reportExport, routes (framework,
expose, filter), uiTier, modelDocs, apiDocs. The runner, the docs generators
and the gates read it through providesOf, so a team's own generator under any
name is seen as the stock one is (ADR-0034 Amendment 12, ruling 5). The nine
single-purpose markers are deprecated and still read through providesOf, since
the Generator interface is under the compatibility policy. Every shipped
generator and reference copy declares provides; the examples' owned copies are
re-synced.
# Conflicts:
#	CHANGELOG.md
#	agent-context-shipped/files/7c4a95c7bcb4c463.md
#	agent-context-shipped/files/8c2f34607e5f23fa.md
#	agent-context-shipped/files/b6dbc9636cb84871.md
#	agent-context-shipped/manifest.json
#	docs/features/cli.md
# Conflicts:
#	CHANGELOG.md
#	agent-context-shipped/files/86517678178eacda.md
#	agent-context-shipped/files/9fbf06132414b6be.md
#	agent-context-shipped/files/a19503c70e2093e8.md
#	agent-context-shipped/files/fbbc2eae2f2e0340.md
#	agent-context-shipped/manifest.json
#	agent-context/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/csharp/expected/.claude/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/java-kotlin-react-tanstack/expected/.claude/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/java-react/expected/.claude/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/python/expected/.claude/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/rust/expected/.claude/skills/metaobjects-verify/SKILL.md
#	fixtures/agent-context-conformance/ts-react-tanstack/expected/.claude/skills/metaobjects-verify/SKILL.md
…e in Python, shipped schema 2)

- Agent requirements and schema pages sort by code unit in TypeScript; Python
  drops its ICU collation emulation (firstmate's sort decision for D0a/G-PY-1).
- Python's agent/schema.md data carries hasMigrate, and its bundled template
  copy is resynced; schemaInputFromRows takes the migrate flag (T1 x D0a).
- Python agent-docs reads shipped manifest schema 2 and picks the -migrate
  stack from migrate.dialect (T1 x G-PY-2).
- scratch-dir test pins its child's cwd, so it passes from server/typescript.
…own explorer page

The D0 explorer fix gives every top-level node a page, so the rules model's
api.operational node now adds Purchasing.html, a search entry and a row on
its package's listings. The test pins exactly those, beside the unchanged
data-payload check.
… refusal, stale-routes warning)

- release.mjs: fragments are assembled and promoted in memory; entries above a prepared
  [VERSION] section stop the release (action "split") instead of opening a second heading,
  before any fragment is deleted.
- Python agent-docs: the manifest round-trips skillsDir, and a project that chose its own
  skills directory is refused untouched with the npx command to refresh it.
- chose_migrate_dialect refuses an unreadable config as ParseError, like read_neutral_config.
- warnUnmarkedRoutesGenerators flags a copy carrying only emitsHonoRoutes.
- writeDbType's JSDoc is back on writeDbType.
- gate_doc_template_drift also fails on an untracked synced copy.
- codegen-ts: ts-writer and build-openapi use the shared compareCodeUnits instead of their
  own copies.
- Python: one _read_config_json reads .metaobjects/config.json for read_neutral_config and
  chose_migrate_dialect; imports sorted; a redundant sort key dropped.
- Tests: the scratch-dir child resolves its metadata import up front instead of pinning cwd;
  rules-inert uses Sets and names stray lines on failure.
@dmealing
dmealing merged commit ffbd5d7 into main Nov 25, 2026
10 checks passed
@dmealing
dmealing deleted the fm/mo-130-gate-bundle-2 branch November 25, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant